package com.kong.constant;

/**
 * @author yang2013
 * @data 2020/10/20 16:08
 */
public enum SexEnum {
    MAN(1,"man"),
    WOMAN(2,"woman"),
    UN_KNOW(0,"unKnown")
    ;
    private Integer code;
    private String sex;

    SexEnum(Integer code, String sex) {
        this.code = code;
        this.sex = sex;
    }

    public Integer getCode() {
        return code;
    }

    public String getSex() {
        return sex;
    }


    public static SexEnum sexOf(String s){
        for (SexEnum sexEnum:values()){
            if (sexEnum.getSex().equals(s)){
                return sexEnum;
            }
        }
        throw new RuntimeException("没有对应的枚举");
    }
}
